home *** CD-ROM | disk | FTP | other *** search
/ Clipper Collection / Clipper Collection.iso / clipper7 / nannws12.arc / CURSOR.ASM < prev    next >
Assembly Source File  |  1986-08-29  |  4KB  |  100 lines

  1. ;
  2. ;****************************************************************
  3. ;                                                               *
  4. ;       CLIPPER ROUTINE - CURSOR ON / OFF ( IBM PC ONLY )       *
  5. ;                      By Kelly Mc Tiernan                      *
  6. ;                                                               *
  7. ;****************************************************************
  8. ;
  9. ;
  10. ;       This routine is called to turn the cursor on and off.
  11. ;       It is a toggle i.e. - call to turn off, upon next call,
  12. ;       cursor is turned on.
  13. ;
  14. ;       CALL CURSW
  15. ;       * Do video i/o
  16. ;       CALL CURSW
  17. ;       * Get input 
  18. ;
  19. ;       Also provides for manual over - ride via WITH <param> ->
  20. ;
  21. ;       CALL CURSW WITH "ON"
  22. ;       CALL CURSW WITH "OFF"
  23. ;
  24. ;       *** NOTE: COMMAND MUST BE CAPS ! ***
  25. ;
  26. PUBLIC    cursw
  27. ;
  28. video    EQU    10h            ; ROM BIOS video interupt
  29. curlin    EQU    01h            ; Set cursor lines function
  30. offlin    EQU    0FF00h         ; Works with MOST PC compatables !
  31. colcur    EQU    0A0Bh          ;   "    "    "   "    "   "  "  !
  32. eqpchk    EQU    11h            ; equipment check interupt
  33. off        EQU    0FFh           ; Flag test value, cursor off ?
  34. on        EQU    00h            ; Flag for cursor on.
  35. bw        EQU    30h            ; bits indicate B/W card.
  36. ;
  37.  
  38. _PROG    SEGMENT    BYTE
  39.         ASSUME    CS:_PROG
  40. ;
  41. cursw    PROC        FAR
  42.         push        bp                      ; standard setup, param's
  43.         mov        bp,sp                   ;
  44.         push        ds                      ; save, need for string compare
  45.         push        es                      ;  "  ,   "   "     "    "  "
  46.         cld                               ; assure proper direction for cmpsb
  47.         cmp        byte ptr cs:[fstpas],0  ; check display type on first pass
  48.         jnz        docurs                ; set start/stop line on first
  49.         mov        byte ptr cs:[fstpas],1  ; to skip this after first time
  50.         int        eqpchk                ; check if color / mono board
  51.         and        ax,bw                ; black and white ?
  52.         cmp        ax,bw                ;
  53.         jnz        docurs                ; color, leave as 0707h
  54.         mov        word ptr cs:[onlin],colcur
  55. docurs:
  56.         mov        ah,curlin               ; set up for cursor on/off function
  57.         lds        si,dword ptr [bp + 6]   ; address of command param. if inc.
  58.         mov        bx,si                   ; save for "OFF" command check
  59.         push        cs                      ; get segment
  60.          pop        es                      ; for compare
  61.         mov        di,offset cs:oncmd      ; get offset for compare
  62.         mov        cx,3                    ; length of on command
  63.         rep        cmpsb                   ; compare string - WITH "ON" ?
  64.         jnz        offtst                  ; not "ON" command, check for "OFF"
  65.         mov        byte ptr cs:[curflg],off ; set flag accordingly
  66.         mov        cx,cs:[onlin]           ; turn it on
  67.         jmp        short curon             ; ( save a byte )
  68. offtst:
  69.         mov        si,bx                   ; get back param. ptr.
  70.         mov        di,offset cs:offcmd     ; and table ptr.
  71.         mov        cx,4                    ; length of "OFF" string
  72.         rep        cmpsb                   ; compare string - WITH "OFF"
  73.         jnz        switch                  ; no over - ride, do toggle
  74.         mov        byte ptr cs:[curflg],on ; set flag
  75.         mov        cx,offlin               ; turn it off
  76.         jmp        short curon             ;
  77. switch:
  78.         mov        cx,cs:[onlin]           ; default is turn off, is it off ?
  79.         cmp        byte ptr cs:[curflg],off
  80.         jz        curon                   ; yes, turn it on
  81.         mov        cx,offlin               ; change up
  82. curon:
  83.         int        video                   ; set cursor lines
  84.         not        byte ptr cs:[curflg]    ; flip switch flag
  85.         pop        es                      ; restore state, normalize stack
  86.         pop        ds                      ;
  87.         pop        bp                      ;
  88.         ret
  89. cursw    ENDP
  90. ;
  91. curflg    DB        00h                     ; ON / OFF FLAG - INIT. SET TO ON
  92. fstpas    DB        00h                      ; for equip check on first pass
  93. oncmd    DB        'ON',0                  ; WITH PARAM - ON COMMAND
  94. offcmd    DB        'OFF',0                 ;  "     "   - OFF COMMAND
  95. onlin    DW        0707h                 ; default cursor ( COLOR / MONO )
  96. ;
  97. _PROG    ENDS
  98.         END
  99.  
  100.